package com.compozents;

import com.argsstack.Args;

public class Compozents {

    private Args args;
    private Object[] goals;

    private Args createArgs(Object[] args) {
        Args result = new Args();
        for (int i = 0; i < args.length / 2; i += 2) {
            if (args[i] == null) {
                throw new IllegalArgumentException("Argument " + i + " should be String(name) value but got null");
            }

            if (!(args[i] instanceof String)) {
                throw new IllegalArgumentException("Argument " + i + " should be String(name) value but got " + args[i].getClass().getSimpleName());
            }

            result.setValue(args[i], args[i + 1]);
        }

        return result;
    }

    public void setArguments(Object... args) {
        this.args = createArgs(args);
    }

    public Object start(Object... goals) {
        this.goals = goals;
        return null;
    }
}